package com.xxx.fallback;

import com.xxx.feignclients.CourseFeignClient;
import com.xxx.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseFeignClientFallback implements FallbackFactory<CourseFeignClient> {
    @Override
    public CourseFeignClient create(Throwable throwable) {
        throwable.printStackTrace();
        return new CourseFeignClient() {
            @Override
            public JSONResult info(String courseIds) {
                return JSONResult.error("调用课程服务CourseController#info服务出错了!");
            }
        };
    }
}
